/*
 * @Descripttion: 文件说明
 * @version: V1.0
 * @Author: GW
 * @Date: 2021-07-29 10:40:41
 * @LastEditors: GW
 * @LastEditTime: 2021-11-04 14:47:07
 */
import { axios } from "../utils/request";

const api = {
    PageList: "/system/role/page",
    RoleList: "/system/role/list",
    Save: "/system/role/save",
    DELETE: "/system/role/delete",
    MenuList: "/system/role/getRoleMenu",
    CheckRoleId: "/system/role/checkRoleId"
};

/**
 * 分页获取角色列表
 * parameter: {
 *     name: '',
 *     menuType: 1
 * }
 * @param parameter
 * @returns {*}
 */
export function PageListRole (parameter) {
    return axios({
        url: api.PageList,
        method: "get",
        params: parameter
    });
}

/**
 * 获取所以角色列表
 */
export function RoleList () {
    return axios({
        url: api.RoleList,
        method: "get"
    });
}

/**
 * 获取用户角色
 */
export function CheckRoleId (parameter) {
    return axios({
        url: api.CheckRoleId,
        method: "get",
        params: parameter
    });
}

/**
 * 新增/修改角色
 * @param {*} data
 */
export function saveSysRole (data) {
    console.log(data);
    return axios({
        url: api.Save,
        isLoading: true,
        method: "post",
        data: data
    });
}

/**
 * 删除角色
 */
export function deleteSysRole (id) {
    console.log(id)
    return axios({
        url: api.DELETE,
        method: "DELETE",
        params: id
    });
}

/**
 * 获取授权菜单
 */
export function MenuList (id) {
    return axios({
        url: api.MenuList,
        method: "get",
        params: id
    });
}